# coding: utf-8
# author: t_wolf

from configs import *
from plugins import *
from urlmaps import *
from variables import *


class VariableContainer:
    def __init__(self):
        pass


def dict2object(pre_dict, deep=1):
    tmp_obj = VariableContainer()

    if deep == 0:
        return pre_dict
    deep -= 1

    for key in pre_dict.keys():
        var = pre_dict.get(key)
        if isinstance(var, dict):
            setattr(tmp_obj, key, dict2object(var, deep))
        else:
            setattr(tmp_obj, key, var)
    return tmp_obj


# 组装变量为变量对象
CONFIGS = dict2object(CONFIGS, 2)
VARIABLES = dict2object(VARIABLES)
PLUGINS = dict2object(PLUGINS)
